while (1){
set str =$(ping -n 3 -w 80 baidu.com)`
echo $str
$result=[regex]::matches($str,'100% 丢失')

if($result.Success)
{
echo 怎么又没网了？发包
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0"
$session.Cookies.Add((New-Object System.Net.Cookie("JSESSIONID", "23DCB77B50561B0707DAC57891DCD774", "/", "202.117.144.205")))
$session.Cookies.Add((New-Object System.Net.Cookie("account", "2022304251", "/", "202.117.144.205")))
$session.Cookies.Add((New-Object System.Net.Cookie("password", "Ab202706", "/", "202.117.144.205")))
Invoke-WebRequest -UseBasicParsing -Uri "http://202.117.144.205:8601/snnuportal/login" `
-Method "POST" `
-WebSession $session `
-Headers @{
"Accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
  "Accept-Encoding"="gzip, deflate"
  "Accept-Language"="zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
  "Cache-Control"="max-age=0"
  "Origin"="http://202.117.144.205:8601"
  "Referer"="http://202.117.144.205:8601/snnuportal/logoff"
  "Upgrade-Insecure-Requests"="1"
} `
-ContentType "application/x-www-form-urlencoded" `
-Body "sourceurl=null&account=2022304251&password=Ab202706&yys="
sleep 2`
}
else{
sleep 2`
}
}
